
import java.awt.Color;
import java.awt.Container;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;


public class Win extends JFrame implements ActionListener {
	private static final long serialVersionUID = 1L;

	private Container c;
	private JButton btJogar;
	private JButton btSair;
	private JLabel label;
	
	private final String g = "/img/wg.jpg";
	private final String r = "/img/wr.jpg";
	
	public Win(Class classe){
		c = getContentPane();
		setLayout(null);
		setBounds(0,0,400,400);
		setBackground(Color.WHITE);
		setTitle("Jogo finalizado");
		
		ImageIcon i;
		String texto;
		if (classe == Raposa.class){
			i = new ImageIcon( getClass().getResource(r) );
			texto = "Raposa";
		}else{
			i = new ImageIcon( getClass().getResource(g) );
			texto = "Gansos";
		}
		label = new JLabel(texto);
		label.setIcon(i);
		label.setBounds(getBounds());
		label.setHorizontalAlignment(SwingConstants.CENTER);
		label.setVerticalTextPosition(SwingConstants.CENTER);
		label.setHorizontalTextPosition(SwingConstants.CENTER);
		label.setFont(new Font("Helvetica", Font.BOLD, 30));
		label.setForeground(Color.YELLOW);
		c.add(label);
		
		btJogar = new JButton("Jogar de novo ?");
		btJogar.setBounds( 50, 350 , 200, 30 );
		btJogar.addActionListener(this);
		c.add(btJogar);

	/*	btSair = new JButton("Sair");
		btSair.setBounds( 450, 350 , 200, 30 );
		btSair.addActionListener(this);
		c.add(btSair); */
		
		//Sem �cones
		setUndecorated(true);
		//Centralizar
		setLocationRelativeTo(null);
		//Exibir
		setVisible(true);
		
		btSair.requestFocus();
		btJogar.requestFocus();
		
	}
	
/*	public static void main(String[] args) {
		new Win(Raposa.class);
	} */
	
	public void actionPerformed(ActionEvent arg0) {
		Object o = arg0.getSource();
		
		if ( o == btSair){
			dispose();
		}else{
			dispose();
			new Main();
			
		}
		
	}

	
}
